@model IEnumerable<OpenPac.Models.District>

@{
    ViewBag.Title = "Index";
}

<h2>Index</h2>

<p>
    @Html.ActionLink("Create New", "Create")
</p>
<table>
    <tr>
        <th></th>
        <th>
            Latitude
        </th>
        <th>
            Longitude
        </th>
        <th>
            State
        </th>
        <th>
            DistrictNumber
        </th>
        <th>
            Candidates
        </th>
        <th>
            MediaOutlets
        </th>
        <th>
            ImportantIssues
        </th>
    </tr>

@foreach (var item in Model) {
    <tr>
        <td>
            @Html.ActionLink("Edit", "Edit", new { id=item.Id }) |
            @Html.ActionLink("Details", "Details", new { id=item.Id }) |
            @Html.ActionLink("Delete", "Delete", new { id=item.Id })
        </td>
        <td>
			@String.Format("{0:F}", item.Latitude)
        </td>
        <td>
			@String.Format("{0:F}", item.Longitude)
        </td>
        <td>
			@item.State
        </td>
        <td>
			@item.DistrictNumber
        </td>
        <td>
			@(item.Candidates == null ? "None" : item.Candidates.Count.ToString())
        </td>
        <td>
			@(item.MediaOutlets == null ? "None" : item.MediaOutlets.Count.ToString())
        </td>
        <td>
			@(item.ImportantIssues == null ? "None" : item.ImportantIssues.Count.ToString())
        </td>
    </tr>
}

</table>


